 /**
 * Telah di terjemahkan oleh TIM indoBlockly
 * http://blockly.developers.or.id
 * indoblockly@developers.or.id
 */
function addGlobalFunction (internalPrefix,functionName,argumentNames) {
    var argumentCount=argumentNames.length;
    var fullName=internalPrefix+"_"+functionName
    Blockly.JavaScript[fullName] = function () {
      var result = functionName+'(';
      for (var i=0; i<argumentCount;i++) {
         var arg=Blockly.JavaScript.valueToCode(this,i,true);
         if ( arg && (i>0))  {
            result+=", ";
         }         
         result+=arg; 
      }
      result+=');\n';      
      return result;
    }
    
    Blockly.Language[fullName] = {
       category: internalPrefix,
       helpUrl: "???",
       init: function() {
            this.setColour(260);
            this.addTitle(functionName);
            for (var i=0; i<argumentCount;i++) {
                this.addInput(argumentNames[i],Blockly.INPUT_VALUE);
            }
            this.setInputsInline(true);
            this.setPreviousStatement(true);
            this.setNextStatement(true);

            }
    }
}


addGlobalFunction ("Menggambar","buangSemua",[]);
addGlobalFunction ("Menggambar","menggambarPersegi",["kiri","atas","lebar","tinggi"]);
addGlobalFunction ("Menggambar","warnaiPersegi",["kiri","atas","lebar","tinggi"]);
addGlobalFunction ("Menggambar","cetakKeLayar",["","dari kiri", "dari atas"]);
addGlobalFunction ("Menggambar","menggambarGaris",["mulai x","mulai y", "sampai x", "sampai y"]);
addGlobalFunction ("Menggambar","warnaiLingkaran",["tengah x", "tengah y", "ukuran"]);
addGlobalFunction ("Menggambar","gambarLingkaran",["tengah x", "tengah y", "ukuran"]);
addGlobalFunction ("Menggambar","aturWarna",[""]);


Blockly.JavaScript["Whio_run"] = function () {
      var result = 'run(';
      
      result+='function(){'+Blockly.JavaScript.statementToCode(this,0,true)+'}';
      result+=',function(){'+Blockly.JavaScript.statementToCode(this,1,true)+'});\n';
      return result;
    }

Blockly.Language["Whio_run"] = {
       category: "Whio",
       helpUrl: "???",
       init: function () {
            this.setColour(100);
            this.addTitle("jalankan");
            this.addInput("Pindahkan phase", Blockly.NEXT_STATEMENT);
            this.addInput("Menggambar phase", Blockly.NEXT_STATEMENT);
            this.setPreviousStatement(true);
        }
    }